package j02class;

class TreeTest{
    public static void main(String[] args) {
        Tree tree1 = new Tree();
        System.out.println("tree1.height = " + tree1.height);//5
        System.out.println("tree1.age = " + tree1.age);//0

        tree1.swing();
        tree1.swing();
        tree1.swing();
        System.out.println("=========");
        Tree.f1();
//        Tree.swing();


    }
}

public class Tree {
    int height=5;
    int age;

    //动态的，不new不可以调用
    public void swing(){
        System.out.println("我晃3！");
    }

    //static，静态的
    //不需要new，就能调用，类名.方法名，或者省略类名
    public static void f1(){
        System.out.println("i am f1");
    }


}

class Phone{
    String brand;
    int age;
    public void call(){}
    public void sendMsg(){}
}
class PhoneTest{
    public static void main(String[] args) {
        Phone p1 = new Phone();
        p1.brand="虾米";//xian mi

        Phone p2 = new Phone();//0x100
        p2.age=1;

        Phone p3 = p2;//
        System.out.println("p3.age = " + p3.age);//1
        System.out.println("p2 = " + p2);
        System.out.println("p3 = " + p3);
        System.out.println(p2==p3);//true

    }
}
